package com.smartdio.company;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import org.eclipse.swt.widgets.Widget;


public class Messages {
	private static final String BUNDLE_NAME = "com.smartdio.company.messages"; //$NON-NLS-1$

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
			.getBundle(BUNDLE_NAME);

	private Messages() {
	}

	public static String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
	
	/**
	 * 国际化某个控件
	 * @param control
	 */
	public static void i18nWidget(Widget control){
		WidgetMessagesUtil.i18nWidget(control,RESOURCE_BUNDLE);
	}
	/**
	 * 国际化指定的控件，以及该控件的子控件
	 * @param control
	 */
	public static void i18nWidgetWithChilds(Widget control){
		WidgetMessagesUtil.i18nWidgetWithChilds(control,RESOURCE_BUNDLE);
	}
}
